local mime_types = {
  ['3gp'] = 'video/3gpp',
  ['3gpp'] = 'video/3gpp',
  ['7z'] = 'application/x-7z-compressed',
  ['a2l'] = 'application/a2l',
  ['ai'] = 'application/postscript',
  ['aml'] = 'application/aml',
  ['asf'] = 'video/x-ms-asf',
  ['asx'] = 'video/x-ms-asf',
  ['atf'] = 'application/atf',
  ['atfx'] = 'application/atfx',
  ['atom'] = 'application/atom+xml',
  ['avi'] = 'video/x-msvideo',
  ['bmp'] = 'image/x-ms-bmp',
  ['cbor'] = 'application/cbor',
  ['cco'] = 'application/x-cocoa',
  ['cdni'] = 'application/cdni',
  ['cea'] = 'application/cea',
  ['cfw'] = 'application/cfw',
  ['cms'] = 'application/cms',
  ['crt'] = 'application/x-x509-ca-cert',
  ['css'] = 'text/css',
  ['dcd'] = 'application/dcd',
  ['der'] = 'application/x-x509-ca-cert',
  ['dii'] = 'application/dii',
  ['dit'] = 'application/dit',
  ['dns'] = 'application/dns',
  ['doc'] = 'application/msword',
  ['dvcs'] = 'application/dvcs',
  ['ear'] = 'application/java-archive',
  ['eps'] = 'application/postscript',
  ['fits'] = 'application/fits',
  ['flv'] = 'video/x-flv',
  ['gif'] = 'image/gif',
  ['gzip'] = 'application/gzip',
  ['h224'] = 'application/h224',
  ['hqx'] = 'application/mac-binhex40',
  ['htc'] = 'text/x-component',
  ['htm'] = 'text/html',
  ['html'] = 'text/html',
  ['rtlua'] = 'text/html',
  ['http'] = 'application/http',
  ['ico'] = 'image/x-icon',
  ['iges'] = 'application/iges',
  ['iotp'] = 'application/iotp',
  ['ipp'] = 'application/ipp',
  ['isup'] = 'application/isup',
  ['jad'] = 'text/vnd.sun.j2me.app-descriptor',
  ['jar'] = 'application/java-archive',
  ['jardiff'] = 'application/x-java-archive-diff',
  ['jng'] = 'image/x-jng',
  ['jnlp'] = 'application/x-java-jnlp-file',
  ['jose'] = 'application/jose',
  ['jpeg'] = 'image/jpeg',
  ['jpg'] = 'image/jpeg',
  ['js'] = 'application/x-javascript',
  ['json'] = 'application/json',
  ['jwt'] = 'application/jwt',
  ['kar'] = 'audio/midi',
  ['kml'] = 'application/vnd.google-earth.kml+xml',
  ['kmz'] = 'application/vnd.google-earth.kmz',
  ['lua'] = 'text/plain',
  ['lxf'] = 'application/lxf',
  ['m4a'] = 'audio/x-m4a',
  ['m4v'] = 'video/x-m4v',
  ['marc'] = 'application/marc',
  ['mbox'] = 'application/mbox',
  ['mf4'] = 'application/mf4',
  ['mid'] = 'audio/midi',
  ['midi'] = 'audio/midi',
  ['mml'] = 'text/mathml',
  ['mng'] = 'video/x-mng',
  ['mov'] = 'video/quicktime',
  ['mp21'] = 'application/mp21',
  ['mp3'] = 'audio/mpeg',
  ['mp4'] = 'application/mp4',
  ['mpeg'] = 'video/mpeg',
  ['mpg'] = 'video/mpeg',
  ['msi'] = 'application/octet-stream',
  ['msm'] = 'application/octet-stream',
  ['msp'] = 'application/octet-stream',
  ['mxf'] = 'application/mxf',
  ['nss'] = 'application/nss',
  ['oda'] = 'application/oda',
  ['odx'] = 'application/odx',
  ['ogg'] = 'application/ogg',
  ['oxps'] = 'application/oxps',
  ['pdb'] = 'application/x-pilot',
  ['pdf'] = 'application/pdf',
  ['pdx'] = 'application/pdx',
  ['pem'] = 'application/x-x509-ca-cert',
  ['pl'] = 'application/x-perl',
  ['pm'] = 'application/x-perl',
  ['png'] = 'image/png',
  ['ppt'] = 'application/vnd.ms-powerpoint',
  ['prc'] = 'application/x-pilot',
  ['ps'] = 'application/postscript',
  ['qsig'] = 'application/qsig',
  ['ra'] = 'audio/x-realaudio',
  ['rar'] = 'application/x-rar-compressed',
  ['rpm'] = 'application/x-redhat-package-manager',
  ['rss'] = 'application/rss+xml',
  ['rtf'] = 'application/rtf',
  ['rtx'] = 'application/rtx',
  ['run'] = 'application/x-makeself',
  ['sdp'] = 'application/sdp',
  ['sea'] = 'application/x-sea',
  ['sgml'] = 'application/sgml',
  ['shtml'] = 'text/html',
  ['sit'] = 'application/x-stuffit',
  ['sql'] = 'application/sql',
  ['srgs'] = 'application/srgs',
  ['svg'] = 'image/svg+xml',
  ['svgz'] = 'image/svg+xml',
  ['swf'] = 'application/x-shockwave-flash',
  ['tcl'] = 'application/x-tcl',
  ['tif'] = 'image/tiff',
  ['tiff'] = 'image/tiff',
  ['tk'] = 'application/x-tcl',
  ['txt'] = 'text/plain',
  ['war'] = 'application/java-archive',
  ['wbmp'] = 'image/vnd.wap.wbmp',
  ['webm'] = 'video/webm',
  ['webp'] = 'image/webp',
  ['wita'] = 'application/wita',
  ['wml'] = 'text/vnd.wap.wml',
  ['wmlc'] = 'application/vnd.wap.wmlc',
  ['wmv'] = 'video/x-ms-wmv',
  ['xhtml'] = 'application/xhtml+xml',
  ['xls'] = 'application/vnd.ms-excel',
  ['xml'] = 'application/xml',
  ['xpi'] = 'application/x-xpinstall',
  ['yang'] = 'application/yang',
  ['zip'] = 'application/zip',
  ['zlib'] = 'application/zlib',
}

return function (filename)
  local ext = string.match(filename, '%.(%w+)$')
  if ext then
    local content_type = mime_types[ext]
    if content_type then
      return { ['Content-Type'] = content_type}
    end
  end
end
